﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

using WeifenLuo.WinFormsUI.Docking;
using UtilityLibrary.WinControls;
using WHC.OrderWater.Commons;

namespace WHC.Hotel.UI
{
    public partial class MainToolWindow : DockContent
    {
        private OutlookBar outlookBar1 = null;
        private AppConfig config = new AppConfig();

        public MainToolWindow()
        {
            InitializeComponent();

            InitializeOutlookbar();            
        }

        private void InitializeOutlookbar()
        {
            outlookBar1 = new OutlookBar();

            #region 酒店客房管理
            if (Portal.gc.HasFunction("Room"))
            {
                OutlookBarBand outlookShortcutsBand = new OutlookBarBand("酒店客房管理");
                outlookShortcutsBand.SmallImageList = this.imageList;
                outlookShortcutsBand.LargeImageList = this.imageList;
                if (Portal.gc.HasFunction("Room/View"))
                {
                    outlookShortcutsBand.Items.Add(new OutlookBarItem("客房状态视图", 0));
                }
                if (Portal.gc.HasFunction("Room/Customer"))
                {
                    outlookShortcutsBand.Items.Add(new OutlookBarItem("客房宾客管理", 1));
                }
                if (Portal.gc.HasFunction("Room/Setting"))
                {
                    outlookShortcutsBand.Items.Add(new OutlookBarItem("客房设置", 2));
                }
                if (Portal.gc.HasFunction("Room/Goods"))
                {
                    outlookShortcutsBand.Items.Add(new OutlookBarItem("客房商品设置", 3));
                }
                if (Portal.gc.HasFunction("Room/Waiter"))
                {
                    outlookShortcutsBand.Items.Add(new OutlookBarItem("客房服务生管理", 4));
                }
                if (Portal.gc.HasFunction("Room/BookIn"))
                {
                    outlookShortcutsBand.Items.Add(new OutlookBarItem("散客预订管理", 5));
                }
                if (Portal.gc.HasFunction("Room/BookIn"))
                {
                    outlookShortcutsBand.Items.Add(new OutlookBarItem("团队预订管理", 6));
                }
                if (Portal.gc.HasFunction("Room/OtherIncome"))
                {
                    outlookShortcutsBand.Items.Add(new OutlookBarItem("客房其他款项登记", 6));
                }
                outlookShortcutsBand.Background = SystemColors.AppWorkspace;
                outlookShortcutsBand.TextColor = Color.White;
                outlookBar1.Bands.Add(outlookShortcutsBand);
            }
            
            #endregion

            #region KTV包间管理
            if (Portal.gc.HasFunction("KTV"))
            {
                OutlookBarBand myBasicBand = new OutlookBarBand("KTV包间管理");
                myBasicBand.SmallImageList = this.imageList;
                myBasicBand.LargeImageList = this.imageList;
                if (Portal.gc.HasFunction("KTV/View"))
                {
                    myBasicBand.Items.Add(new OutlookBarItem("KTV包间状态视图", 0));
                }
                if (Portal.gc.HasFunction("KTV/Setting"))
                {
                    myBasicBand.Items.Add(new OutlookBarItem("KTV包间设置", 1));
                }
                if (Portal.gc.HasFunction("KTV/Goods"))
                {
                    myBasicBand.Items.Add(new OutlookBarItem("KTV商品设置", 3));
                }
                if (Portal.gc.HasFunction("KTV/Waiter"))
                {
                    myBasicBand.Items.Add(new OutlookBarItem("KTV服务生管理", 4));
                }
                if (Portal.gc.HasFunction("KTV/BookIn"))
                {
                    myBasicBand.Items.Add(new OutlookBarItem("KTV预订管理", 5));
                }
                if (Portal.gc.HasFunction("KTV/OtherIncome"))
                {
                    myBasicBand.Items.Add(new OutlookBarItem("KTV其他款项登记", 6));
                }
                myBasicBand.Background = SystemColors.AppWorkspace;
                myBasicBand.TextColor = Color.White;
                outlookBar1.Bands.Add(myBasicBand);
            }
            #endregion

            #region 茶室管理
            if (Portal.gc.HasFunction("Tea"))
            {
                OutlookBarBand moneyBand = new OutlookBarBand("茶室管理");
                moneyBand.SmallImageList = this.imageList;
                moneyBand.LargeImageList = this.imageList;
                if (Portal.gc.HasFunction("Tea/View"))
                {
                    moneyBand.Items.Add(new OutlookBarItem("茶室状态视图", 0));
                }
                if (Portal.gc.HasFunction("Tea/Setting"))
                {
                    moneyBand.Items.Add(new OutlookBarItem("茶室设置", 1));
                }
                if (Portal.gc.HasFunction("Tea/Goods"))
                {
                    moneyBand.Items.Add(new OutlookBarItem("茶室商品设置", 3));
                }
                if (Portal.gc.HasFunction("Tea/Waiter"))
                {
                    moneyBand.Items.Add(new OutlookBarItem("茶室服务生管理", 4));
                }
                if (Portal.gc.HasFunction("Tea/BookIn"))
                {
                    moneyBand.Items.Add(new OutlookBarItem("茶室预订管理", 5));
                }
                if (Portal.gc.HasFunction("Tea/OtherIncome"))
                {
                    moneyBand.Items.Add(new OutlookBarItem("茶室其他款项登记", 6));
                }
                moneyBand.Background = SystemColors.AppWorkspace;
                moneyBand.TextColor = Color.White;
                outlookBar1.Bands.Add(moneyBand);
            }
            #endregion

            outlookBar1.Dock = DockStyle.Fill;
            outlookBar1.SetCurrentBand(0);
            outlookBar1.ItemClicked += new OutlookBarItemClickedHandler(OnOutlookBarItemClicked);
            outlookBar1.ItemDropped += new OutlookBarItemDroppedHandler(OnOutlookBarItemDropped);

            //outlookBar1.FlatArrowButtons = true;
            this.panel1.Controls.AddRange(new Control[] { outlookBar1 });
        }

        private void OnOutlookBarItemClicked(OutlookBarBand band, OutlookBarItem item)
        {
            DockContent conten = null;
            //FrmMaintenance frmMaintenance = null;
            //FrmOtherIncome frmOtherIncome = null;
            switch (item.Text)
            {
                #region 酒店客房管理

                case "客房状态视图":
                    Portal.gc.MainDialog.ShowContent("客房状态视图", typeof(FrmRoomStatusView));
                    break;
                case "客房宾客管理":
                    Portal.gc.MainDialog.ShowContent("客房宾客管理", typeof(FrmCustomer));
                    break;
                case "客房设置":
                    Portal.gc.MainDialog.ShowContent("客房设置", typeof(FrmRoom));
                    break;
                case "客房商品设置":
                    Portal.gc.MainDialog.ShowContent("客房商品设置", typeof(FrmGoods));
                    break;
                case "客房服务生管理":
                    Portal.gc.MainDialog.ShowContent("客房服务生管理", typeof(FrmWaiter));
                    break;
                case "散客预订管理":
                    Portal.gc.MainDialog.ShowContent("散客预订管理", typeof(FrmBookRoomManager));
                    break;
                case "团队预订管理":
                    Portal.gc.MainDialog.ShowContent("团队预订管理", typeof(FrmTeamBookRoomManager));
                    break;
                #endregion

                #region 茶室管理
                case "茶室状态视图":
                    Portal.gc.MainDialog.ShowContent("茶室状态视图", typeof(FrmTeaSuiteView));
                    break;
                case "茶室设置":
                    Portal.gc.MainDialog.ShowContent("茶室设置", typeof(FrmSuite));
                    break;
                case "茶室商品设置":
                    Portal.gc.MainDialog.ShowContent("茶室商品设置", typeof(FrmTeaGoods));
                    break;
                case "茶室服务生管理":
                    Portal.gc.MainDialog.ShowContent("茶室服务生管理", typeof(FrmTeaWaiter));
                    break;
                case "茶室预订管理":
                    Portal.gc.MainDialog.ShowContent("茶室预订管理", typeof(FrmBookTeaManager));
                    break;
                case "客房其他款项登记":
                    Portal.gc.MainDialog.ShowContent("客房其他款项登记", typeof(FrmOtherIncome));
                    break;
                case "茶室其他款项登记":
                    Portal.gc.MainDialog.ShowContent("茶室其他款项登记", typeof(FrmTeaOtherIncome));
                    break;

                #endregion

                #region KTV包间管理
                case "KTV包间状态视图":
                    Portal.gc.MainDialog.ShowContent("KTV包间状态视图", typeof(FrmKTVSuiteView));
                    break;
                case "KTV包间设置":
                    Portal.gc.MainDialog.ShowContent("KTV包间设置", typeof(FrmKTV));
                    break;
                case "KTV商品设置":
                    Portal.gc.MainDialog.ShowContent("KTV商品设置", typeof(FrmKTVGoods));
                    break;
                case "KTV服务生管理":
                    Portal.gc.MainDialog.ShowContent("KTV服务生管理", typeof(FrmKTVWaiter));
                    break;
                case "KTV预订管理":
                    Portal.gc.MainDialog.ShowContent("KTV预订管理", typeof(FrmBookKTVManager));
                    break;
                case "KTV其他款项登记":
                    Portal.gc.MainDialog.ShowContent("KTV其他款项登记", typeof(FrmKTVOtherIncome));
                    break;

                #endregion

                default:
                    break;
            }
        }

        private void OnOutlookBarItemDropped(OutlookBarBand band, OutlookBarItem item)
        {
            //			string message = "Item : " + item.Text + " was dropped...";
            //			MessageBox.Show(message);            
        }

        private void MainToolWindow_Load(object sender, EventArgs e)
        {
        }
    }
}
